<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: rgb(39, 102, 196);
        }
    </style>
    <script>
        window.onload = () =>{
            var div = document.querySelector("div");
            div.onclick = () =>{
                var str = "rgb("
                    str += getRandom(0,255)+','+getRandom(0,255)+','+getRandom(0,255)+')';
                    div.style.backgroundColor = str;
                }
                    
            var getRandom = (i,ax) =>{
                return Math.floor(Math.random()*(ax-i) + i)
            }
        }
    </script>
</head>
<body>
    <div></div>
</body>
</html>